//
//  Utils.m
//
//  Created by Northwan on 15/4/12.
//  Copyright (c) 2015年 All rights reserved.
//

#import "Utils.h"

@implementation Utils


/**
 * 处理tabview的线条样式
 */
+(void)setSeparatorInsetWithTableView:(UITableView *)tableView insets:(UIEdgeInsets)insets{
    if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [tableView setSeparatorInset:insets];
    }
    if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [tableView setLayoutMargins:insets];
    }
}

+(void)setSeparatorInsetWithTableViewCell:(UITableViewCell *)cell insets:(UIEdgeInsets)insets{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:insets];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:insets];
    }
}

+ (void)refreshComplete:(UITableView *)tableView{
    [tableView headerEndRefreshing];
    [tableView footerEndRefreshing];
}

+(NSString *)stringWithDate:(NSDate *)date formatterStr:(NSString *)formatterStr{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = formatterStr;
    return [formatter stringFromDate:date];
}

@end
